package com.company.util;

import com.company.constant.SysConstant;
import com.company.factory.CommandFactory;

import java.util.Collections;
import java.util.Comparator;

/**
 * @author : cyw
 * @date : created in  下午5:43 2021/6/11
 * @description :
 * @modified by :
 * @Version : $
 */

public class DataUtils {
    /**
     * 显示目录
     */
    public static  void showData(){
        for (String path : SysConstant.FILE_DATA){
            System.out.println(path);
        }
    }
    /**
     * 排序目录
     */
    public static  void sortData(){
        Collections.sort(SysConstant.FILE_DATA, new Comparator<String>() {
            @Override
            public int compare(String s, String t1) {
                if (s.length() > t1.length()){
                    String temp = s;
                    s = t1;
                    t1 = temp;
                }
                for (int i=3;i<s.length();i++){
                    if (s.charAt(i) != t1.charAt(i)){
                        return s.charAt(i) - t1.charAt(i);
                    }
                }
                return -1;
            }

        });
    }

    /**
     * 打印菜单
     */
    public static void showMenu(){
        System.out.println(SysConstant.CHAR_MENU+"菜单"+SysConstant.CHAR_MENU);
        System.out.println("1.当前目录路径");
        System.out.println("2.显示当前所有文件和目录");
        System.out.println("3.打开目录");
    }

    public static void parsingCommand(int command){

    }
}
